Unit BFormMainUnit;

{$mode objfpc}{$H+}

Interface

Uses
  Classes, SysUtils, BSessionUnit, BDojoWebUnit;

Type

{ BFormMainClass }

 BFormMainClass = Class(BWebFormClass)
  Private
    bDataGrid: BWebGridClass;
    Procedure GetContent(Var aResponse: String);
    Procedure BuildLayout;
  Public
    Property DataGrid: BWebGridClass Read bDataGrid;
    Constructor Build(Const aSession: BSessionClass);
End;

Implementation

{ BFormMainClass }

Procedure BFormMainClass.GetContent(Var aResponse: String);
Begin
  aResponse:=
    '[{' +
      'id: 0, ' +
      'caption: "Caption 1", ' +
      'shortcut: "Shortcut 1"' +
    '},{' +
      'id: 1, ' +
      'caption: "Caption 2", ' +
      'shortcut: "Shortcut 2"' +
    '},{' +
      'id: 2, ' +
      'caption: "Caption 3", ' +
      'shortcut:"Shortcut 3"' +
    '},{' +
      'id: 3, ' +
      'caption: "Caption 4", ' +
      'shortcut: "Shortcut 4"' +
    '}]';
End;

Procedure BFormMainClass.BuildLayout;
Begin
  bDataGrid := BWebGridClass.Build(Self, @GetContent, 'Identifier', rgCenter);
  bDataGrid.AddColumn('Caption', 'caption', 200);
  bDataGrid.AddColumn('Shortcut', 'shortcut', 200);
End;

Constructor BFormMainClass.Build(Const aSession: BSessionClass);
Begin
  Inherited Build(aSession, 640, 480);
  Layout := lyBorder;
  Resizable := TRUE;
  Title := 'DataGrid1';
  BuildLayout;
  Startup;
End;

End.

